package br.com.cadele.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import br.com.cadele.model.Professor;

public class ProfessorDAO extends BaseDao{

	private static final long serialVersionUID = 7972602399234765408L;
	public ProfessorDAO() {
		super();
	}
	public void executeSQL(String sql){
		super.executeSQL(sql);
		// TODO
	}
	public ArrayList<Professor> executeQuery(String sql){
		ResultSet rs = getQueryResultSet(sql);
		ArrayList<Professor> professores = new ArrayList<Professor>();
		try {
			Professor professor;
			while(rs.next()){
				professor = new Professor();
				professor.setSiape(rs.getString("siape"));
				professor.setCodigoDepartamento(rs.getString("codigoDepartamento"));
				professor.setCodigoDepartamento(rs.getString("endereco"));
				professor.setCodigoDepartamento(rs.getString("email"));
				professor.setNome(rs.getString("nome"));
				professor.setCodigoDepartamento(rs.getString("cpf"));
				professor.setCodigoDepartamento(rs.getString("telefone"));
				professores.add(professor);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try {
				rs.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return professores;
	}
}
